
clear

cd "D:\data_replication"

import delimited estimation\4_demand_estimation\pc8plus_i_k.csv, clear 
keep v1 v3
rename v1 product_id
rename v3 k
save data\firm_size_distribution\pc8plus_i_k.dta, replace

use data\firm_size_distribution\zeta_product_id.dta, clear
merge 1:1 product_id using data\firm_size_distribution\pc8plus_i_k.dta
keep k zeta_product_id
drop if k == 0
drop if k == .
order k zeta_product_id
sort k
rename zeta_product_id zeta_k
save data\firm_size_distribution\zeta_k.dta, replace
export delimited using data\firm_size_distribution\zeta_k.csv, replace

rm data\firm_size_distribution\pc8plus_i_k.dta
